/*
 * Created on Aug 26, 2007
 * 
 * $Id: ContourCreator.java Feb 8, 2004 izpack-frontend
 * Copyright (C) 2005 Andy Gombos
 * 
 * File : ContourCreator.java 
 * Description : TODO Add description
 * Author's email : gumbo@users.berlios.de
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 *     
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nativ;

import geom.Polygon;
import geom.PolygonList;

import java.awt.geom.Point2D;
import java.util.Arrays;


public class ContourGenerator
{
	public static PolygonList generateContour(PolygonList polys)
	{
		Polygon p = polys.get(0);
		Point2D pts[] = p.getPoints().toArray(new Point2D.Double[]{});
		
		Point2D iPts[] = generateContour(pts, 0.1);
		
		Polygon p2 = new Polygon();
		p2.add(Arrays.asList(iPts));
		
		PolygonList pl = new PolygonList();
		pl.add(p2);
		
		return pl;
	}
	
	private static native Point2D[] generateContour(Point2D pts[], double dist);
	
	static {
		System.out.println("Loading");
		System.loadLibrary("ContourGenerator");
	}
}
